<?php
/** 
 * 邮件队列Master （守护进程）
 * @author barry.wu
 * example : php cronIndex.php emailJob doEmail
 */
class email extends cron {
	
	public function runFirst() {
	
	}
	
	public function runLast() {
	
	}
	
	public function doEmail() {
		$this->view->assign ( 'name', 'wufaliang' );
		$this->view->display ( 'email/add.html' );
		exit ();
		while ( true ) {
			$objQueue = core::queue ()->factory ( 'EMAIL' );
			$notifyMessage = $objQueue->get ( 'DELAY_NOTIFY' );
			$count = 0;
			if ($notifyMessage != 'HTTPSQS_GET_END') {
				$notifyMessage = base64_encode ( $notifyMessage );
				exec ( "nohup /usr/bin/php " . _APP_ROOT . "cronIndex.php emailQueue doEmailNotify message='" . $notifyMessage . "' &" );
				if ($count % 100 == 0) {
					sleep ( 1 );
				}
				$count ++;
			} else {
				sleep ( 5 );
			}
		}
	}
}
